//
//  LogView.m
//  07_Work
//
//  Created by dllo on 16/7/23.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "LogView.h"

@implementation LogView

+ (UIView *)createBackViewFrame:(CGRect)frame {
    UIView *backView = [[UIView alloc] initWithFrame:frame];
    UIImageView *backImageView = [[UIImageView alloc] initWithFrame:frame];
    UIImage *backImage = [UIImage imageNamed:@"welcome_2"];
    [backImageView setImage:backImage];
    [backView addSubview:backImageView];
    return backView;
}

// 创建logo的view
+ (UIImageView *)createLogeViewFrame:(CGRect)frame {
    UIImageView *logoImageView = [[UIImageView alloc] initWithFrame:frame];
    UIImage *logoImage = [UIImage imageNamed:@"logo_lagou"];
    [logoImageView setImage:logoImage];
    return logoImageView;
}
// textField view
+ (UIView *)createViewFrame:(CGRect)frame backGroundColor:(UIColor *)color {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor clearColor];
    
    UIImageView *idImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    idImageView.backgroundColor = [UIColor blackColor];
    UIImage *idImage = [UIImage imageNamed:@"icon_username"];
    [idImageView setImage:idImage];
    [view addSubview:idImageView];
    
    UIImageView *keyImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 42, 40, 40)];
    keyImageView.backgroundColor = [UIColor blackColor];
    UIImage *keyImage = [UIImage imageNamed:@"icon_password"];
    [keyImageView setImage:keyImage];
    [view addSubview:keyImageView];
    
    UITextField *idTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 0, view.frame.size.width - 40, 40)];
    idTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    [view addSubview:idTextField];
    
    UITextField *keyTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 42, view.frame.size.width - 40, 40)];
    keyTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    //    keyTextField.delegate = self;
    [view addSubview:keyTextField];
    
    // 设置弧度
    UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:idTextField.bounds byRoundingCorners:UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *idlayer = [CAShapeLayer layer];
    idlayer.frame = idTextField.bounds;
    idlayer.path = path.CGPath;
    idTextField.layer.mask = idlayer;
    
    UIBezierPath *path1 = [UIBezierPath bezierPathWithRoundedRect:keyTextField.bounds byRoundingCorners:UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *keyLayer = [CAShapeLayer layer];
    keyLayer.frame = idTextField.bounds;
    keyLayer.path = path1.CGPath;
    keyTextField.layer.mask = keyLayer;
    
    UIBezierPath *path2 = [UIBezierPath bezierPathWithRoundedRect:idImageView.bounds byRoundingCorners:UIRectCornerTopLeft cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *idLa = [CAShapeLayer layer];
    idLa.frame = idImageView.bounds;
    idLa.path = path2.CGPath;
    idImageView.layer.mask = idLa;
    
    UIBezierPath *path3 = [UIBezierPath bezierPathWithRoundedRect:keyImageView.bounds byRoundingCorners:UIRectCornerBottomLeft cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *keyLa = [CAShapeLayer layer];
    keyLa.frame = keyImageView.bounds;
    keyLa.path = path3.CGPath;
    keyImageView.layer.mask = keyLa;
    return view;
}
// 登录 button
+ (UIButton *)createLoginButtonFrame:(CGRect)frame {
    UIButton *logButton = [UIButton buttonWithType:UIButtonTypeSystem];
    logButton.frame = frame;
    logButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8];
    [logButton setTitle:@"登录" forState:UIControlStateNormal];
    [logButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    logButton.layer.cornerRadius = 5;
    return logButton;
}
// 忘记密码
+ (UIButton *)createForgetKeyButtonFrame:(CGRect)frame {
    UIButton *forgetButton = [UIButton buttonWithType:UIButtonTypeSystem];
    forgetButton.frame = frame;
    [forgetButton setTitle:@"忘记密码" forState:UIControlStateNormal];
    [forgetButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    forgetButton.titleLabel.font = [UIFont systemFontOfSize:18];
    return forgetButton;
}
// 注册 button
+ (UIButton *)createRegButtonFrame:(CGRect)frame {
    UIButton *regButton = [UIButton buttonWithType:UIButtonTypeSystem];
    regButton.frame = frame;
    [regButton setTitle:@"现在注册拉勾" forState:UIControlStateNormal];
    [regButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    regButton.titleLabel.font = [UIFont systemFontOfSize:20];
    regButton.titleLabel.font = [UIFont boldSystemFontOfSize:22];
    return regButton;
}
// line
+ (UIView *)createLineFrame:(CGRect)frame {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor clearColor];
    
    UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(10, 15, view.frame.size.width / 2 - 30, 2)];
    lineView1.backgroundColor = [UIColor whiteColor];
    [view addSubview:lineView1];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(view.frame.size.width / 2 - 4, 0, 40, 30)];
    label.text = @"or";
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:20];
    [view addSubview:label];
    
    UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(view.frame.size.width / 2 + 30, 15, view.frame.size.width / 2 - 40, 2)];
    lineView2.backgroundColor = [UIColor whiteColor];
    [view addSubview:lineView2];
    return view;
}
// 随便逛逛
+ (UIButton *)createStrollButtonFrame:(CGRect)frame {
    UIButton *strollButton = [UIButton buttonWithType:UIButtonTypeSystem];
    strollButton.frame = frame;
    [strollButton setTitle:@"随便逛逛>" forState:UIControlStateNormal];
    [strollButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    strollButton.titleLabel.font = [UIFont systemFontOfSize:20];
    return strollButton;
}
// 创建 注册页 textField
+ (UIView *)createRegTextFieldFrame:(CGRect)frame {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor clearColor];
    
    UITextField *phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 0, view.frame.size.width - 40, 40)];
    phoneTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    //    phoneTextField.delegate = self;
    phoneTextField.placeholder = @"  请输入手机号";
    [phoneTextField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
    //    phoneTextField.delegate = self;
    [view addSubview:phoneTextField];
    UITextField *checkTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 42, view.frame.size.width - 40, 40)];
    checkTextField.placeholder = @"  请输入验证码";
    [checkTextField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
    checkTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    //    checkTextField.delegate = self;
    [view addSubview:checkTextField];
    
    UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeSystem];
    checkButton.frame = CGRectMake(view.frame.size.width - 100, 42, 100, 40);
    [checkButton setTitle:@"获取验证码" forState:UIControlStateNormal];
    [view addSubview:checkButton];
    [checkButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(view.frame.size.width - 110, 49, 2, 26)];
    lineView.backgroundColor = [UIColor grayColor];
    [view addSubview:lineView];
    
    UIImageView *phoneImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    phoneImageView.backgroundColor = [UIColor blackColor];
    UIImage *phoneImage = [UIImage imageNamed:@"phone"];
    [phoneImageView setImage:phoneImage];
    [view addSubview:phoneImageView];
    
    UIImageView *checkImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 42, 40, 40)];
    checkImageView.backgroundColor = [UIColor blackColor];
    UIImage *checkImage = [UIImage imageNamed:@"check"];
    [checkImageView setImage:checkImage];
    [view addSubview:checkImageView];
    
    UILabel *regLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 440, view.frame.size.width - 200, 40)];
    regLabel.text = @"注册代表你已同意";
    regLabel.textColor = [UIColor whiteColor];
    regLabel.font = [UIFont systemFontOfSize:17];
    [view addSubview:regLabel];
    
    return view;
}

// 条款 协议
+ (UIView *)createDelegateFrame:(CGRect)frame {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor clearColor];
    UILabel *regLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 10, view.frame.size.width - 200, 30)];
    regLabel.text = @"注册代表你已同意";
    regLabel.textColor = [UIColor whiteColor];
    regLabel.font = [UIFont systemFontOfSize:17];
    [view addSubview:regLabel];
    
    UIButton *delegateButton = [UIButton buttonWithType:UIButtonTypeSystem];
    delegateButton.frame = CGRectMake(view.frame.size.width - 207, 10, 105, 30);
    [delegateButton setTitle:@"拉勾用户协议" forState:UIControlStateNormal];
    delegateButton.titleLabel.textAlignment = 0;
    delegateButton.titleLabel.font = [UIFont systemFontOfSize:17];
    [delegateButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    [view addSubview:delegateButton];
    return view;
}
// 注册页 注册button
+ (UIButton *)createRegRegButtonFrame:(CGRect)frame {
    UIButton *regButton = [UIButton buttonWithType:UIButtonTypeSystem];
    regButton.frame = frame;
    regButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.9];
    [regButton setTitle:@"注册" forState:UIControlStateNormal];
    [regButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    return regButton;
}
// 返回登录
+ (UIButton *)createBackButtonFrame:(CGRect)frame {
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    backButton.frame = frame;
    backButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.4];
    [backButton setTitle:@"返回登录" forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    return backButton;
}
// 返回button
+ (UIButton *)createforgetButtonFrame:(CGRect)frame {
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    backButton.frame = frame;
    [backButton setTitle:@"< 返回" forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    backButton.titleLabel.font = [UIFont systemFontOfSize:20];
    return backButton;
}
// textField
+ (UIView *)createForgetTextViewFrame:(CGRect)frame {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor clearColor];
    UITextField *phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(60, 0, view.frame.size.width - 120, 40)];
    phoneTextField.placeholder = @"手机号  (仅支持中国大陆号)";
    phoneTextField.font = [UIFont systemFontOfSize:20];
    [view addSubview:phoneTextField];
    
    UIView *underPhoneLine = [[UIView alloc] initWithFrame:CGRectMake(30, 50, view.frame.size.width - 60, 2)];
    underPhoneLine.backgroundColor = [UIColor grayColor];
    underPhoneLine.alpha = 0.3;
    [view addSubview:underPhoneLine];
    
    UITextField *checkTextField = [[UITextField alloc] initWithFrame:CGRectMake(60, 60, view.frame.size.width - 220, 40)];
    checkTextField.placeholder = @"验证码";
    checkTextField.font = [UIFont systemFontOfSize:20];
    [view addSubview:checkTextField];
    
    UIView *underCheckLine = [[UIView alloc] initWithFrame:CGRectMake(30, 110, view.frame.size.width - 60, 2)];
    underCheckLine.backgroundColor = [UIColor grayColor];
    underCheckLine.alpha = 0.3;
    [view addSubview:underCheckLine];
    
    UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeSystem];
    checkButton.frame = CGRectMake(view.frame.size.width - 160, 65, 100, 30);
    [checkButton setTitle:@"获取验证码" forState:UIControlStateNormal];
    [checkButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    checkButton.titleLabel.font = [UIFont systemFontOfSize:20];
    [view addSubview:checkButton];
    return view;
}
// 下一步 button
+ (UIButton *)createNextButtonFrame:(CGRect)frame {
    UIButton *nextStepButton = [UIButton buttonWithType:UIButtonTypeSystem];
    nextStepButton.frame = frame;
    nextStepButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8];
    [nextStepButton setTitle:@"下一步" forState:UIControlStateNormal];
    [nextStepButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    return nextStepButton;
}

@end
